<#assign title ="阶段管理">
<#include "/include/layout.ftl">
<#macro css>
</#macro>
<#macro js>
</#macro>
<#macro body>
<#import "/include/select.ftl" as items>
	<section class="content-header">
      <h1>
        ${title}
        <small>添加</small>
      	<a class="btn btn-default pull-right back" href="javascript:;"><i class="fa fa-reply"></i> 返回</a>
      </h1>
    </section>
    <section class="content">
 		<div class="box box-info">
 			<div class="row">
 				<div class="col-sm-10">
			        <form action="${contextPath}/sys/grow/stage/save" method="post" id="documentForm" class="form-horizontal">
			          <input type="hidden" name="id" value="${data.id}" />
			          <input type="hidden" name="nextid" value="${data.nextid}" />
			          <input type="hidden" name="ruleid" value="${data.ruleid}" />
			          <input type="hidden" name="orderno" value="${data.orderno}" />
		              <div class="box-body">
		                <div class="form-group">
		                  <label class="col-sm-2 control-label">阶段名称:</label>
		                  <div class="col-sm-4">
		                    <input name="stagename" value="${data.stagename}" class="form-control"  placeholder="排序编号" required maxlength=20 />
		                  </div>
		                </div>
		                <div class="form-group">
		                  <label class="col-sm-2 control-label">天数:</label>
		                  <div class="col-sm-4">
		                    <input name="days" value="${data.days}" class="form-control"  placeholder="角色名称" required digits=true max=999999 />
		                  </div>
		                </div>
		                <div class="form-group">
		                  <label class="col-sm-2 control-label">消耗(单位:元):</label>
		                  <div class="col-sm-4">
		                    <input name="consume" value="${data.consume}" class="form-control" placeholder="角色编号" required number=true min=0 maxlength=20 />
		                  </div>
		                </div>
		              </div>
		              <div class="box-footer">
		              	<div class="col-sm-2"></div>
		              	 <div class="col-sm-6">
		              	 	<a class="btn btn-default" id="reset" ><i class="fa fa-rotate-left"></i> 重置</a>
		              	 	<a class="btn btn-info" id="submit"><i class="fa fa-save"></i> 确定</a>
			             </div>
		              </div>
		            </form>
		         </div>
            </div>
        </div>
    </section>
	<script type="text/javascript">
		//ajax 返回
		function showResponse(responseText, statusText) {
			var code = responseText.code;
			var msg = responseText.msg;
			if (code == "1") {
				  layer.alert(msg,{icon: 1}, function(index){
					  location.href="${contextPath}/sys/grow/stage/index.html?ruleid=${data.ruleid}";
				 	  layer.close(index);
				});  
			} else {
				layer.msg(msg, {icon: 2});
			}
		}	
		
		//表单验证
		function validateForm(){
		   return $("#documentForm").validate().form();
		}
	</script>
</#macro>